1. Field of the Invention
Embodiments of the present invention generally relate to graphics programming and more specifically to loading integer-based data into a graphics processing system.
2. Description of the Related Art
Over the past decade, the cost of adding on-chip logic to processors has substantially decreased. Consequently, certain types of processors, such as advanced graphics processing units (GPUs), now include functionality not previously available in earlier GPU designs. For example, newly introduced GPUs are now able to perform full integer processing operations; whereas, such operations could not be effectively performed on the GPU. One benefit of this new capability is that more efficient graphics processing may now be performed on the GPU, thereby increasing overall performance in the graphics pipeline.
To fully realize additional processing capabilities of advanced GPUs, as much GPU functionality as possible needs to be exposed to graphics application developers. Among other things, doing so enables graphics application developers to tailor their shader programs to optimize the way GPUs process graphics scenes and images. Exposing new full integer GPU processing capabilities to graphics application developers requires that the application programming interface (API) be configured with new calls and libraries that make new features and functionalities directly accessible by developers.
GPU APIs typically expose an interface to graphics application developers that enables an application executing on the host CPU to load image data, in the form of one or more texture maps, into GPU local memory for greater access and processing efficiency by the GPU. Texture map data is commonly represented as one or more intensity values per texture element, called a “texel.” For example, a texel may include a single intensity value per texel. Alternately, a texel may include four values, corresponding to red, green and blue intensity, and opacity. Each value within a texel is commonly represented using either a floating-point value, such as a standard 32-bit floating-point number, or a fixed-point normalized value. For example, an 8-bit normalized value includes 256 codes, ranging from 0x00 to 0xFF, where 0x00 corresponds to a floating-point value of “0.0” and 0xFF corresponds to a floating-point value of “1.0.” The incremental codes between 0x00 and 0xFF correspond to 254 increasing floating-point values between zero and one.
In prior art GPUs, the data stored in a texture map is used for a very limited scope of computation, typically performed by fixed-function shaders that are limited to using floating-point math. Thus, data retrieved from a texture map by a shader is first converted to a floating-point representation before being presented to the shader. Data written to the texture map by the shader is presumed to originate as floating-point data from the shader and may be converted from the presumed floating-point format to a specific storage format, such as normalized 8-bit values, before being stored. With the introduction of GPUs that able to perform full integer processing, the prior art data path connecting a shader unit to the GPU local memory becomes an impediment to enabling the use of integer data within a texture map. By always casting texture data to a floating-point or normalized representation in this way, the GPU's ability to perform more general computation using data stored in a texture map is highly constrained.
As the foregoing illustrates, what is needed in the art is a mechanism to extend the use of integer data types within texture maps.